﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using ZhouYu.DreamTour.Attributes;
using ZhouYu.DreamTour.BLL.IService;
using ZhouYu.DreamTour.Model;
using ZhouYu.DreamTour.ViewModel;
using ZhouYu.DreamTour.Web.Models;

namespace ZhouYu.DreamTour.Web.Controllers
{
    public class HomeController : Controller
    {

        private ITeamService _teamService;
        private IUserService _userService;
        private IRouteService _routeService;
        private ISpecialtyService _specialtyService;
        private IGroupService _groupService;
        private ITrafficService _trafficRepository;
        private IScenicService _scenicService;
        private IFoodService _foodService;
        private IHotelService _hotelService;
        private IOrderService _orderService;
        private IPaymentRecordService _PaymentRecordService;
        public HomeController(IUserService userService, IRouteService routeService, ISpecialtyService specialtyService, IGroupService groupService, ITrafficService trafficRepository, IScenicService scenicService, ITeamService teamService, IFoodService foodService, IHotelService hotelService, IOrderService orderService, IPaymentRecordService PaymentRecordService)
        {
            _userService = userService;
            _routeService = routeService;
            _specialtyService = specialtyService;
            _groupService = groupService;
            _trafficRepository = trafficRepository;
            _scenicService = scenicService;
            _teamService = teamService;
            _foodService = foodService;
            _hotelService = hotelService;
            _orderService = orderService;
            _PaymentRecordService = PaymentRecordService;
        }

        public HomeController()
        {

        }
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>       
        public ActionResult Index()
        {
            //取cookie里面的信息
            var cookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            if (cookie != null)
            {
                //获取存在的cookie
                var ticket = FormsAuthentication.Decrypt(cookie.Value);
                string userData = ticket.UserData;
                if (!string.IsNullOrEmpty(userData))
                {
                    //存储在session里面
                    UserInfo userInfo = new UserInfo();
                    userInfo.User_Id = Convert.ToInt32(userData.Split('#')[0]);
                    userInfo.User_Name = userData.Split('#')[1];
                    userInfo.User_Pwd = userData.Split('#')[2];
                    UserInfoContext.userInfoContext.UserInfo = userInfo;
                }
            }
            //查询首页景点
            ViewBag.ScenicList = _scenicService.GetScenicFromIndex().data;
            //获取主图的集合
            ViewBag.ScenicPicList = _scenicService.GetScenicPicList().data;
            //调用地方特产页面信息展示
            ViewBag.SpecialtyInfo = _specialtyService.GetGoodsList().data;
            //调用地方特产页面图片展示
            ViewBag.SpecialtyPicture = _specialtyService.GetPictureList().data;
            //获取结伴同行集合
            ViewBag.Colleague = _userService.GetColleague().data;
            return View();
        }

        /// <summary>   
        /// 餐饮详情
        /// </summary>
        /// <returns></returns>
        public ActionResult FoodDetails(int CaterId)
        {
            //调用根据Id获取餐饮详情
            ResponseResult responseResult = _foodService.GetCaterAccommodsInfoById(CaterId);
            //获取餐饮集合
            ViewBag.List = _foodService.GetCaterAccommodsInfo().data;
            return View(responseResult.data);
        }

        /// <summary>
        /// 酒店详情
        /// </summary>
        /// <returns></returns>
        public ActionResult HotelDetails(int HotelId)
        {
            //调用根据Id获取酒店详情信息
            ResponseResult responseResult = _hotelService.GetHotelDetailInfoById(HotelId);
            //调用获取酒店页面信息
            ViewBag.HotelInfo = _hotelService.GetHotelsInfo().data;
            return View(responseResult.data);
        }


        /// <summary>
        /// 酒店预订
        /// </summary>
        /// <returns></returns>
        public ActionResult HotelReservation()
        {
            //调用获取酒店名称集合
            ViewBag.GetHotelNameList = _hotelService.GetHotelNameList().data;
            return View();
        }

        /// <summary>
        /// 餐饮预订
        /// </summary>
        /// <returns></returns>
        public ActionResult FoodReserve()
        {
            return View();
        }

        /// <summary>
        /// 餐饮住宿
        /// </summary>
        /// <returns></returns>
        public ActionResult CateringAccommodation()
        {
            //调用获取餐饮页面信息
            ViewBag.CateringInfo = _foodService.GetCaterAccommodsInfo().data;
            //调用获取酒店页面信息
            ViewBag.HotelInfo = _hotelService.GetHotelsInfo().data;
            //调用获取酒店页面图片信息
            ViewBag.HotelPicInfo = _hotelService.GetHotelsPicInfo().data;
            return View();
        }

        /// <summary>
        /// 地方特产
        /// </summary>
        /// <returns></returns>
        public ActionResult Specialty()
        {
            //调用地方特产页面信息展示
            ViewBag.SpecialtyInfo = _specialtyService.GetGoodsList().data;
            //调用地方特产页面图片展示
            ViewBag.SpecialtyPicture = _specialtyService.GetPictureList().data;
            return View();
        }

        /// <summary>
        /// 地方特产--查看购物车
        /// </summary>
        /// <returns></returns>
        public ActionResult Specialty_ViewCart()
        {
            return View();
        }

        /// <summary>
        /// 地方特产--拍下商品
        /// </summary>
        /// <returns></returns>
        public ActionResult Specialty_Products(int GoodsId)
        {
            //调用根据Id获取地方特产信息
            ResponseResult responseResult = _specialtyService.GetGoodsInfoById(GoodsId);
            //调用地方特产页面图片展示
            ViewBag.SpecialtyPicture = _specialtyService.GetPictureList().data;
            //调用根据用户Id查询所有配送地址
            int User_Id = UserInfoContext.userInfoContext.UserInfo.User_Id;
            ViewBag.CheckAllDeliAdress = _specialtyService.CheckAllDeliAdressByUser_Id(User_Id).data;
            //ViewBag.deliveryAddressesListOther = deliveryAddressesListOther;
            return View(responseResult.data);
        }

        /// <summary>
        /// 地方特产--评价2
        /// </summary>
        /// <returns></returns>
        public ActionResult Specialty_Evaluate()
        {
            return View();
        }

        /// <summary>
        /// 地方特产--确认收货
        /// </summary>
        /// <returns></returns>
        public ActionResult Specialt_ConfirmReceipt(int Order_Id, string Order_No) 
        {
            
            //调用根据订单编号查询商品信息
            ResponseResult responseResult = _specialtyService.CheckGoodsInfoByOrder_No(Order_No);
            //根据订单Id查询收货人信息
            ViewBag.CheckOrderOverInfoByOrder_Id = _specialtyService.CheckOrderOverInfoByOrder_Id(Order_Id).data;
            return View(responseResult.data);
        }


        /// <summary>
        /// 地址特产--确认收货评论提交
        /// </summary>
        /// <returns></returns>
        public ActionResult Specialt_Commentary(string Order_No)
        {
            //调用根据订单编号查询商品信息
            ResponseResult responseResult = _specialtyService.CheckGoodsInfoByOrder_No(Order_No);
            return View(responseResult.data);
        }

        /// <summary>
        /// 地址特产--详情    
        /// </summary>
        /// <returns></returns>
        public ActionResult Specialt_Datails(int GoodsId)
        {
            //调用地方特产页面图片展示
            ViewBag.SpecialtyPicture = _specialtyService.GetPictureList().data;
            //调用根据Id获取地方特产信息
            ResponseResult responseResult = _specialtyService.GetGoodsInfoById(GoodsId);
            //调用根据商品Id查询商品发货地
            ViewBag.CheckSuAddress = _specialtyService.CheckStartPlaceByGoodsId(GoodsId).data;
            //调用根据用户Id查询商品配送地址
            int User_Id = UserInfoContext.userInfoContext.UserInfo.User_Id;
            ViewBag.CheckDeliAdress = _specialtyService.CheckDeliAdressByUser_Id(User_Id).data;
            Goods goods = responseResult.data;
            //调用根据订单类型和商品名称查询销售量
            ViewBag.GetSalesCount = _specialtyService.GetSalesCount(goods.GoodsName);
            //调用根据商品Id获取地方特产详情信息
            ViewBag.GetGoodsDetailsInfo = _specialtyService.GetGoodsDetailsInfoById(GoodsId).data;
            //调用查询用户平均点评分数
            ViewBag.CheckAvgScore = _specialtyService.CheckAvgScore(GoodsId).data;
            //调用查询特产评论数
            ViewBag.CheckUserCommentCount = _specialtyService.CheckUserCommentCount(GoodsId).data;
            //调用获取商品评论列表
            ViewBag.GetUsercommentsList = _specialtyService.GetUsercommentsList(GoodsId).data;
            return View(responseResult.data);
        }

        /// <summary>
        /// 地址特产--在线支付
        /// </summary>
        /// <returns></returns>
        public ActionResult Specialt_Payment(int GoodsId, string Order_No, string Order_ProInfo, string total, string Order_Content)
        {
            //调用根据Id获取地方特产信息
            ResponseResult responseResult = _specialtyService.GetGoodsInfoById(GoodsId);
            //根据用户Id查询现金账号表
            int User_Id = UserInfoContext.userInfoContext.UserInfo.User_Id;
            ViewBag.GetCashnumber = _userService.GetCashnumber(User_Id).data;
            //获取订单编号
            ViewBag.Order_No = Order_No;
            //获取产品名称
            ViewBag.Order_ProInfo = Order_ProInfo;
            //获取商品总价
            ViewBag.total = total;
            //获取商品描述
            ViewBag.Order_Content = Order_Content;
            return View(responseResult.data);
        }


        /// <summary>
        /// 行程导航--付款
        /// </summary>
        /// <returns></returns>
        public ActionResult Itinerary_Payment(string RouteIntroduce, double total, string TName, string Order_No)
        {
            //获取当前操作用户ID
            int User_Id = UserInfoContext.userInfoContext.UserInfo.User_Id;
            //根据用户ID查询现金账号表
            ViewBag.Cashnumber = _userService.GetCashnumber(User_Id).data;
            //产品名称
            ViewBag.TName = TName;
            //产品描述
            ViewBag.RouteIntroduce = RouteIntroduce;
            //订单总价
            ViewBag.total = total;
            //获取提交订单是产生的订单号
            ViewBag.Order_No = Order_No;
            return View();
        }


        /// <summary>
        /// 行程导航--我要预订
        /// </summary>
        /// <returns></returns>
        public ActionResult Itinerary_Booking(int Id, int AdultNum, int childrenNum, int Number, int xiaoji)
        {
            //根据ID获取预定路线信息
            ViewBag.TouristRouteInfo = _scenicService.GetScenicDetails(Id).data;
            //成人个数
            ViewBag.AdultNum = AdultNum;
            //儿童个数
            ViewBag.childrenNum = childrenNum;
            //保险份数
            ViewBag.Number = Number;
            //保险所需金额
            ViewBag.xiaoji = xiaoji;
            return View();
        }



        /// <summary>
        /// 行程导航--我要预订详情
        /// </summary>
        /// <returns></returns>
        public ActionResult Itinerary_BookingDetails(int Id)
        {
            //根据ID获取路线信息
            ViewBag.TouristRouteInfo = _scenicService.GetScenicDetails(Id).data;
            return View();
        }

        /// <summary>
        /// 行程导航--详情
        /// </summary>
        /// <returns></returns>
        public ActionResult Itinerary_Details()
        {
            return View();
        }

        /// <summary>
        /// 行程简介详情
        /// </summary>
        /// <returns></returns>
        public ActionResult Itinerary_Introduction()
        {
            return View();
        }

        /// <summary>
        /// 会员登陆
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Login()
        {
            ////取cookie里面的信息
            //var cookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            //if (cookie != null)
            //{
            //    //获取存在的cookie
            //    var ticket = FormsAuthentication.Decrypt(cookie.Value);
            //    string userData = ticket.UserData;
            //    if (!string.IsNullOrEmpty(userData))
            //    {
            //        //存储在session里面
            //        UserInfo userInfo = new UserInfo();
            //        userInfo.User_Id= Convert.ToInt32(userData.Split('#')[0]);
            //        userInfo.User_Name = userData.Split('#')[1];
            //        userInfo.User_Pwd = userData.Split('#')[2];
            //        UserInfoContext.userInfoContext.UserInfo= userInfo;
            //        return Redirect("/Home/Index");
            //    }
            //}
            return View();
        }

        /// <summary>
        /// 会员中心--抵用卷
        /// </summary>
        /// <returns></returns>
        public ActionResult User_AllowanceVol()
        {
            int userId = UserInfoContext.userInfoContext.UserInfo.User_Id;
            //通过Session获取当前登录用户的信息
            ViewBag.user = _userService.GetUserById(userId).data;

            ViewBag.voucher = _userService.GetVoucherById(userId).data;
            return View();
        }

        /// <summary>
        /// 会员中心--结伴同行
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Colleague()
        {
            ViewBag.route = _scenicService.GetScenicExhibitions().data;
            return View();
        }

        /// <summary>
        /// 会员中心--个人资料
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Data()
        {
            int userId = UserInfoContext.userInfoContext.UserInfo.User_Id;
            //通过Session获取当前登录用户的信息
            ViewBag.user = _userService.GetUserById(userId).data;
            return View();
        }

        /// <summary>
        /// 会员中心--旅游卷
        /// </summary>
        /// <returns></returns>
        public ActionResult User_TouristVol()
        {
            int userId = UserInfoContext.userInfoContext.UserInfo.User_Id;
            //通过Session获取当前登录用户的信息
            ViewBag.user = _userService.GetUserById(userId).data;

            ViewBag.tourVo = _userService.GetTourVo(userId).data;
            return View();
        }

        /// <summary>
        /// 会员中心--配送地址1
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Address()
        {
            //取cookie里面的信息
            var cookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            if (cookie != null)
            {
                //获取存在的cookie
                var ticket = FormsAuthentication.Decrypt(cookie.Value);
                string userData = ticket.UserData;
                if (!string.IsNullOrEmpty(userData))
                {
                    //存储在session里面
                    UserInfo userInfo = new UserInfo();
                    userInfo.User_Id = Convert.ToInt32(userData.Split('#')[0]);
                    userInfo.User_Name = userData.Split('#')[1];
                    userInfo.User_Pwd = userData.Split('#')[2];
                    UserInfoContext.userInfoContext.UserInfo = userInfo;
                }
            }
            return View();
        }

        /// <summary>
        /// 会员中心--配送地址2
        /// </summary>
        /// <returns></returns>
        public ActionResult User_AddressTwo()
        {
            //取cookie里面的信息
            var cookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            if (cookie != null)
            {
                //获取存在的cookie
                var ticket = FormsAuthentication.Decrypt(cookie.Value);
                string userData = ticket.UserData;
                if (!string.IsNullOrEmpty(userData))
                {
                    //存储在session里面
                    UserInfo userInfo = new UserInfo();
                    userInfo.User_Id = Convert.ToInt32(userData.Split('#')[0]);
                    userInfo.User_Name = userData.Split('#')[1];
                    userInfo.User_Pwd = userData.Split('#')[2];
                    UserInfoContext.userInfoContext.UserInfo = userInfo;
                }
            }
            return View();
        }

        /// <summary>
        /// 会员中心--提现
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Cash()
        {
            ViewBag.cashList = _userService.GetCash(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            ViewBag.Count = _userService.GetCashCount(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            ViewBag.reCount = _userService.GetCashReturnCount(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            ViewBag.cashBalance = _userService.GetCashbalance(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            return View();
        }

        /// <summary>
        /// 会员中心--点评
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Comment()
        {
            //取cookie里面的信息
            var cookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            if (cookie != null)
            {
                //获取存在的cookie
                var ticket = FormsAuthentication.Decrypt(cookie.Value);
                string userData = ticket.UserData;
                if (!string.IsNullOrEmpty(userData))
                {
                    //存储在session里面
                    UserInfo userInfo = new UserInfo();
                    userInfo.User_Id = Convert.ToInt32(userData.Split('#')[0]);
                    userInfo.User_Name = userData.Split('#')[1];
                    userInfo.User_Pwd = userData.Split('#')[2];
                    UserInfoContext.userInfoContext.UserInfo = userInfo;
                }
            }
            return View();
        }
        /// <summary>
        /// 会员中心--订单
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Order(string Order_No = "")
        {
            //支付成功添加支付记录
            if (!string.IsNullOrEmpty(Order_No) & Order_No != UserInfoContext.userInfoContext.OrderNumberNo)
            {
                PaymentRecord paymentRecord = new PaymentRecord();
                OrderInfo order = _orderService.SelOrderInfoByNo(Order_No).data;
                paymentRecord.User_Id = UserInfoContext.userInfoContext.UserInfo.User_Id;
                paymentRecord.Payment_OrderRemark = order.Order_Content;// 商品描述
                paymentRecord.Payment_OrderName = order.Order_ProInfo; // 订单名称
                paymentRecord.Payment_Amount = order.Order_Money;// 付款金额
                paymentRecord.Payment_OrderNo = order.Order_No; // 外部订单号，商户网站订单系统中唯一的订单号
                paymentRecord.Payment_OutingTime = order.Order_OutingTime;//出发日期
                ResponseResult responseResult = _PaymentRecordService.AddPaymentRecordInfo(paymentRecord);
                //支付成功将订单状态修改
                ResponseResult response = new ResponseResult();
                if (order.Order_Type.Contains("旅游"))
                {
                    response = _orderService.UpdateOrderStatus(Order_No, 1);
                }
                if (order.Order_Type.Contains("特产"))
                {
                    response = _orderService.UpdateOrderStatus(Order_No,2);
                }
                if (order.Order_Type.Contains("团购"))
                {
                    response = _orderService.UpdateOrderStatus(Order_No, 1);
                }
            }
            UserInfoContext.userInfoContext.OrderNumberNo = Order_No;


            //查询订单状态
            //特产 0是未付款,1是待点评,2是待收货,,4是已点评
            //其他:0是未付款,1是待点评,4是已点评
            //查询待未付款
            ViewBag.Unpaid = _orderService.Orderstatus(0, UserInfoContext.userInfoContext.UserInfo.User_Id);
            //查询待点评
            ViewBag.Comment = _orderService.Orderstatus(1, UserInfoContext.userInfoContext.UserInfo.User_Id);
            //查询特产待收货
            ViewBag.Receiving = _orderService.Orderstatus(2, UserInfoContext.userInfoContext.UserInfo.User_Id);
            //用户订单
            ViewBag.ordes = _orderService.GetOrder(UserInfoContext.userInfoContext.UserInfo.User_Id);
            return View();
        }

        /// <summary>
        /// 会员中心--积分
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Integral()
        {
            //根据用户Id查询积分
            Custompoints user = _userService.Queryintegral(UserInfoContext.userInfoContext.UserInfo.User_Id);
            ViewBag.UserId = user;

            return View();
        }

        /// <summary>
        /// 会员中心--提问
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Questions()
        {
            //根据用户Id查询用户提问记录
            ViewBag.count = _userService.Queryuserask(UserInfoContext.userInfoContext.UserInfo.User_Id);
            //根据用户Id查询用户回复记录
            ViewBag.Replynumber = _userService.QueryReply(UserInfoContext.userInfoContext.UserInfo.User_Id);
            return View();
        }

        /// <summary>
        /// 会员中心--申请结伴同行
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Apply()
        {
            Colleague colleague = new Colleague();
            colleague.User_Id = UserInfoContext.userInfoContext.UserInfo.User_Id;
            ViewBag.Colleague = _userService.GetColleagueByUId(colleague).data;
            return View();
        }

        /// <summary>
        /// 会员中心--返现
        /// </summary>
        /// <returns></returns>
        public ActionResult User_CashAccount(string Order_Money="")
        {
            //金额不为空时
            if (Order_Money != "") 
            {
                //获取现金账号信息
                Cashnumber cashnumber = _userService.GetCashnumber(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
                cashnumber.Cash_balance = Convert.ToDecimal(Order_Money);
                cashnumber.Cash_UpdateTime = DateTime.Now;
                //充值现金帐号修改余额 
                _userService.RechargeCashBalance(cashnumber);
            }
            ViewBag.reList = _userService.GetCashReturn(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            ViewBag.Count = _userService.GetCashCount(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            ViewBag.reCount = _userService.GetCashReturnCount(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            ViewBag.cashBalance = _userService.GetCashbalance(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            return View();
        }

        /// <summary>
        /// 会员中心--修改密码
        /// </summary>
        /// <returns></returns>
        public ActionResult User_UpdatePwd()
        {
            //取cookie里面的信息
            var cookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            if (cookie != null)
            {
                //获取存在的cookie
                var ticket = FormsAuthentication.Decrypt(cookie.Value);
                string userData = ticket.UserData;
                if (!string.IsNullOrEmpty(userData))
                {
                    //存储在session里面
                    UserInfo userInfo = new UserInfo();
                    userInfo.User_Id = Convert.ToInt32(userData.Split('#')[0]);
                    userInfo.User_Name = userData.Split('#')[1];
                    userInfo.User_Pwd = userData.Split('#')[2];
                    UserInfoContext.userInfoContext.UserInfo = userInfo;
                }
            }
            return View();
        }

        /// <summary>
        /// 会员中心--账号安全
        /// </summary>
        /// <returns></returns>
        public ActionResult User_AccountSecurity()
        {
            int userId = UserInfoContext.userInfoContext.UserInfo.User_Id;
            //通过Session获取当前登录用户的信息
            ViewBag.user = _userService.GetUserById(userId).data;
            return View();
        }

        /// <summary>
        /// 会员中心
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Center()
        {
            int userId = UserInfoContext.userInfoContext.UserInfo.User_Id;
            //通过Session获取当前登录用户的信息
            ViewBag.user = _userService.GetUserById(userId).data;
            //通过Session获取当前登录用户的现金账户余额信息
            ViewBag.cash = _userService.GetCashById(userId).data;
            //通过Session获取当前登录用户的订单信息
            ViewBag.order = _userService.GetOrderById(userId).data;
            return View();
        }

        /// <summary>
        /// 会员中心--注册
        /// </summary>
        /// <returns></returns>
        public ActionResult User_Register()
        {
            return View();
        }



        /// <summary>
        /// 交通路线--详情1 
        /// </summary>
        /// <returns></returns>
        public ActionResult Traffic_DatailsOne(string TranType, string StartAddress, string StopAddress, string CarNumber)
        {
            ViewBag.RouteListzero = _trafficRepository.GetRouteInfos(TranType, StartAddress, StopAddress, CarNumber, out List<RouteInfoSimulation> RouteListone, out List<RouteInfoSimulation> RouteListtwo).data;
            ViewBag.RouteListone = RouteListone;
            ViewBag.RouteListtwo = RouteListtwo;
            return View();
        }

        /// <summary>
        /// 交通路线--详情2
        /// </summary>
        /// <returns></returns>
        public ActionResult Traffic_DatailsTwo()
        {
            return View();
        }

        /// <summary>
        /// 旅游景点
        /// </summary>
        /// <returns></returns>
        public ActionResult Scenic()
        {
            //获取旅游景点集合
            ViewBag.ScenicList = _scenicService.GetScenicExhibitions().data;
            //获取图片
            ViewBag.ScenicPicList = _scenicService.GetScenicPicList().data;
            return View();
        }

        /// <summary>
        /// 旅游景点--详情
        /// </summary>
        /// <returns></returns>
        public ActionResult Scenic_Datails(int Pic_Id, int TouristRouteId, string Pic_Url, int BeCarefulInfoId)
        {
            ViewBag.Pic_Url = Pic_Url;
            ViewBag.BeCarefulInfoList = _scenicService.GetBeCarefulInfo(BeCarefulInfoId).data;
            ViewBag.PicListById = _scenicService.GetPicListById(Pic_Id).data;
            ViewBag.ScenicDetails = _scenicService.GetScenicDetails(TouristRouteId).data;
            return View();
        }


        /// <summary>
        /// 旅游路线
        /// </summary>
        /// <returns></returns>
        public ActionResult Route()
        {
            //获取旅游路线的集合
            ViewBag.ScenicList = _scenicService.GetScenicExhibitions().data;
            //获取主图的集合
            ViewBag.ScenicPicList = _scenicService.GetScenicPicList().data;
            return View();
        }


        /// <summary>
        /// 旅游路线--详情
        /// </summary>
        /// <returns></returns>
        public ActionResult Route_Datails(int HotelId, int Pic_Id, int TouristRouteId, string Pic_Url, int BeCarefulInfoId)
        {
            //按条件获取具体酒店信息
            ViewBag.HotelInfo = _routeService.GetHotelByID(HotelId).data;
            //传输一个图片路径
            ViewBag.Pic_Url = Pic_Url;
            //根据ID获取某个景点的注意事项
            ViewBag.BeCarefulInfoList = _scenicService.GetBeCarefulInfo(BeCarefulInfoId).data;
            //拿到主图下的次图
            ViewBag.PicListById = _scenicService.GetPicListById(Pic_Id).data;
            //获取具体单个旅游路线的详细信息
            ViewBag.ScenicDetails = _scenicService.GetScenicDetails(TouristRouteId).data;
            return View();
        }

        /// <summary>
        /// 旅游团购
        /// </summary>
        /// <returns></returns>
        public ActionResult Group()
        {           
            //查询旅游团购的出发城市
            ViewBag.CheckAllStartPlace = _groupService.CheckAllStartPlace().data;
            return View();
        }


        /// <summary>
        ///团购分部视图
        /// </summary>
        /// <returns></returns>
        public ActionResult GroupChild(string StartPlace="")
        {                   
            //调用旅游团购图片展示
            ViewBag.GroupPicture = _groupService.GetTourPictureList().data;
            if (!string.IsNullOrEmpty(StartPlace))
            {
                //根据出发城市筛选旅游团购
                ViewBag.GroupInfo=_groupService.GetTourInfoByStartPlace(StartPlace).data;
            }
            else
            {  //调用旅游团购信息展示
                ViewBag.GroupInfo = _groupService.GetTourList().data;
            }
            return View();
        }


        /// <summary>
        /// 旅游团购--详情
        /// </summary>
        /// <returns></returns>
        public ActionResult Group_Datails(int TourId)
        {
            //调用旅游团购图片展示
            ViewBag.GroupPicture = _groupService.GetTourPictureList().data;
            //调用根据Id获取旅游团购详情信息
            ResponseResult responseResult = _groupService.GetTourDetailInfoById(TourId);
            TourDetailRelation tourDetailRelation = responseResult.data;
            //调用根据订单类型和团购名称来获取人数
            ViewBag.GetCount = _groupService.GetCount(tourDetailRelation.Title);
            return View(responseResult.data);
        }

        /// <summary>
        /// 旅游团购预定
        /// </summary>
        /// <returns></returns>
        public ActionResult Group_Booking(string title,decimal price,string startPlace,DateTime StartTime,string Pic_Url,int TourId)
        {
            //获取团购信息对象
            GroupInfo groupInfo = new GroupInfo();
            groupInfo.Title = title;
            groupInfo.Price = price;
            groupInfo.StartPlace = startPlace;
            groupInfo.StartTime = StartTime;
            groupInfo.Pic_Url = Pic_Url;
            groupInfo.TourId = TourId;
            ViewBag.groupInfo = groupInfo;
            return View();
        }

        /// <summary>
        /// 团购预定详情
        /// </summary>
        /// <returns></returns>
        public ActionResult Group_BookingDatails(string title, decimal price, string startPlace, DateTime StartTime, string Pic_Url, int TourId, int AdultNum, int childrenNum, int Number, int xiaoji)
        {
            //调用根据Id获取旅游团购详情信息
            ResponseResult responseResult = _groupService.GetTourDetailInfoById(TourId);
            TourDetailRelation tourDetailRelation = responseResult.data;
            //获取团购信息对象
            GroupInfo groupInfo = new GroupInfo();
            groupInfo.Title = title;
            groupInfo.Price = price;
            groupInfo.StartPlace = startPlace;
            groupInfo.StartTime = StartTime;
            groupInfo.Pic_Url = Pic_Url;
            groupInfo.TourId = TourId;
            groupInfo.Tour_Desc = tourDetailRelation.Tour_Desc;
            ViewBag.groupInfo = groupInfo;
            //成人个数
            ViewBag.AdultNum = AdultNum;
            //儿童个数
            ViewBag.childrenNum = childrenNum;
            //保险份数
            ViewBag.Number = Number;
            //保险所需金额
            ViewBag.xiaoji = xiaoji;
            return View();
        }


        /// <summary>
        /// 旅游团购--付款
        /// </summary>
        /// <returns></returns>
        public ActionResult Group_Payment(string Desc, double total, string title, string Order_No)
        {
            //获取当前操作用户ID
            int User_Id = UserInfoContext.userInfoContext.UserInfo.User_Id;
            //根据用户ID查询现金账号表
            ViewBag.Cashnumber = _userService.GetCashnumber(User_Id).data;
            //产品名称
            ViewBag.TName = title;
            //产品描述
            ViewBag.RouteIntroduce = Desc;
            //订单总价
            ViewBag.total = total;
            //获取提交订单是产生的订单号
            ViewBag.Order_No = Order_No;
            return View();
        }

        /// <summary>
        /// 团队简介--加入中国梦想游
        /// </summary>
        /// <returns></returns>
        public ActionResult Team_Join()
        {
            List<TeamInfo> teamInfos = _teamService.TeamInfo();
            ViewBag.Team = teamInfos;
            return View();
        }


        /// <summary>
        /// 团队简介--关于中国梦想游
        /// </summary>
        /// <returns></returns>
        public ActionResult Team_About(string name)
        {
            List<TeamInfo> teamInfos = _teamService.TeamInfo();
            ViewBag.Team = teamInfos;

            ViewBag.teamObj = _teamService.GetTeam(name);
            return View();
        }

        /// <summary>
        /// 自动生成简介
        /// </summary>
        /// <returns></returns>
        public ActionResult AutoGenerationIntro()
        {
            return View();
        }

        /// <summary>
        /// 提现银行卡页面
        /// </summary>
        /// <returns></returns>
        public ActionResult CashWithdrawal()
        {
            //获取当前登录用户绑定的银行卡集合
            ViewBag.Bank = _userService.QueryUserBank(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            ViewBag.cash = _userService.GetCashbalance(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            return View();
        }

        /// <summary>
        /// 兑换旅游卷页面
        /// </summary>
        /// <returns></returns>
        public ActionResult ExchangeTravel()
        {
            ViewBag.cash = _userService.GetCashbalance(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            return View();
        }

        /// <summary>
        /// 会员中心-我的银行卡页面
        /// </summary>
        /// <returns></returns>s
        public ActionResult User_Bank()
        {
            //获取当前登录用户绑定的银行卡集合
            ViewBag.Bank = _userService.QueryUserBank(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            return View();
        }

        /// <summary>
        /// 会员中心-绑定银行卡页面
        /// </summary>
        /// <returns></returns>s
        public ActionResult BindBank()
        {
            return View();
        }

        /// <summary>
        /// 会员中心-解绑银行卡页面
        /// </summary>
        /// <returns></returns>s
        public ActionResult DelBank()
        {
            //获取当前登录用户绑定的银行卡集合
            ViewBag.Bank = _userService.QueryUserBank(UserInfoContext.userInfoContext.UserInfo.User_Id).data;
            return View();
        }

        /// <summary>
        /// 行程导航分部视图
        /// </summary>
        /// <returns></returns>
        public ActionResult Category(int PriceOne = 0, int PriceTwo =0,int Duration=0,string Certification="",string OutPlace="")
        {
            ResponseResult responseResult = new ResponseResult();
            //按价格,持续时长,景点等级查询数据
            if (PriceOne > 0 || PriceTwo > 0 || Duration>0 || !string.IsNullOrEmpty(Certification)||!string.IsNullOrEmpty(OutPlace))
            {
                //根据价格查询路线景点
                ViewBag.ScenicList = _scenicService.SelScenicByPrice(PriceOne, PriceTwo, Duration, Certification,OutPlace).data;
            }
            else
            {
                //获取旅游路线的集合
                ViewBag.ScenicList = _scenicService.GetScenicExhibitions().data;
            }
            //获取主图的集合
            ViewBag.ScenicPicList = _scenicService.GetScenicPicList().data;
            return View();
        }
    }
}